package com.tanhua.dubbo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.domain.db.Log;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface LogMapper extends BaseMapper<Log> {

    @Select("select count( DISTINCT user_id )  num from tb_log   where log_time=#{todayStr} and  type=#{type}")
    Integer queryNumLoginOrRegistry(@Param("todayStr") String todayStr, @Param("type")String type);

    @Select("select count( DISTINCT user_id )  num from tb_log   where log_time=#{todayStr} ")
    Integer queryNumActive(String todayStr);

    @Select("select  count( DISTINCT  user_id) num      from tb_log   where log_time=#{todayStr} and  user_id " +
            "  in  (select  user_id     from tb_log   where log_time=#{yesTodayStr} and  type='0102')")
    Integer queryRetention1d(@Param("todayStr") String todayStr, @Param("yesTodayStr")String yesTodayStr);
}
